﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cocos2D;

namespace TestTiger.Screens
{
    public abstract class SceneBase : CCScene
    {
        public bool BackPressed;

        public SceneBase()
        {
            this.Init();
        }

        public override void Visit()
        {
            if (BackPressed)
            {
                BackPressed = false;
                bool quit = false;
                OnBackkeyPreesed(ref quit);
                if (quit)
                {
#if WP8
                    StatisticsHelper.EndAsync();
                    App.Current.Terminate();
#else
                    throw new Exception("Quit");
#endif
                }
            }
            base.Visit();
        }

        public virtual void OnBackkeyPreesed()
        {
        }
        public virtual void OnBackkeyPreesed(ref bool quitGame)
        {
            OnBackkeyPreesed();
        }
    }
    public class TigerScreen : SceneBase
    {
        public override bool Init()
        {

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("pokers.plist", "pokers");

            var sp16 = new CCSprite("16.png");
            sp16.Position = new CCPoint(300, 300);
            AddChild(sp16);
            return base.Init();
        }
    }
}
